import re
p0=r'C:\Users\lsf\Downloads\com.dataviz.docstogo_4.002_1496\res'

def r0(p):
	f=open(p0+r'\values'+p,'r')
	s=f.read()
	f.close()
	return s

l=[]
s=r0(r'\public.xml')
s=re.findall('<public type="string" name="[\w\.]+?" id="0x\w+?" />',s)
for i in s:
	m=re.match('<public type="string" name="([\w\.]+?)" id="0x\w+?" />',i)
	l+=[m.group(1)]

def d0(lan):
	d={}
	s=r0(lan+r'\strings.xml')
	a=re.findall('<string name="[\w\.]+?">[\w\W]*?</string>',s)
	for i in a:
		m=re.match('<string name="([\w\.]+?)">([\w\W]*?)</string>',i)
		d[m.group(1)]=m.group(2)
	a=re.findall('<string name="[\w\.]+?" />',s)
	for i in a:
		m=re.match('<string name="([\w\.]+?)" />',i)
		d[m.group(1)]=''
	return d


d1={}

def f0(lan):
	global l,d1
	d=d0(lan)
	for i in d:
		if i in l:
			d1[i]=d[i]
			l.remove(i)
f0('-zh-rCN')
#f0('-zh')
f0('')
# f0('-lv-rLV')
f0('-ru')
print l


f=open(p0+r'\values\strings1.xml','w')
f.write('<?xml version="1.0" encoding="utf-8"?>\n')
f.write('<resources>\n')
for i in d1:f.write('    <string name="'+i+'">'+d1[i]+'</string>\n')
for i in l:f.write('    <string name="'+i+'" />\n')
f.write('</resources>')
f.close()
